﻿#include "mainwindow.h"
#include "changeip.h"
#include "login.h"

#include <QApplication>
#include <QApplication>
#include <QTextEdit>
#include <QProcess>
#include <QVBoxLayout>
#include <QWidget>
#include <QLabel>
#include <QDebug>
#include <QTextCodec>
#include <QFile>
#include <QTextStream>

//#if defined(_MSC_VER) && (_MSC_VER >= 1600)
//#pragma execution_character_set("utf-8")
//#endif
//void displayIpConfig(QVBoxLayout *layout, const QString &output) {
//    // Split output by lines
//    QStringList lines = output.split("\n");
//
//    // Create a group layout
//    QVBoxLayout *groupLayout = nullptr;
//    QString currentGroup;
//
//    for (const QString &line : lines) {
//        if (line.trimmed().isEmpty()) {
//            continue; // Skip empty lines
//        }
//
//        // Check if the line starts a new group
//        if (!line.startsWith(" ")) {
//            if (groupLayout) {
//                layout->addLayout(groupLayout); // Add previous group layout to the main layout
//            }
//            QLabel *groupLabel = new QLabel("<b>" + line.trimmed() + "</b>");
//            layout->addWidget(groupLabel); // Add group label to the main layout
//            groupLayout = new QVBoxLayout(); // Create a new group layout
//            currentGroup = line.trimmed();
//        } else {
//            if (groupLayout) {
//                QLabel *lineLabel = new QLabel(line.trimmed());
//                groupLayout->addWidget(lineLabel); // Add line to the current group layout
//            }
//        }
//    }
//
//    if (groupLayout) {
//        layout->addLayout(groupLayout); // Add the last group layout to the main layout
//    }
//}


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setWindowIcon(QIcon(":/new/prefix1/pkuncii.ico"));
    //QProcess process;
    ////获取设备信息  ip及mac地址
    //process.start("ipconfig", QStringList() << "/all");
    //process.waitForFinished();
    //QString output =QString::fromLocal8Bit( process.readAllStandardOutput());
    //
    ////output.replace(" \n", "");



    ////输出文件
    //QFile file("output.txt");
    //if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
    //    qDebug() << "Cannot open file for writing: " << file.errorString();
    //    return 1;
    //}
    //QTextStream out(&file);
    //out.setCodec("UTF-8"); // 设置编码为 UTF-8
    //out << output;

    //file.close();
     Login w;
    //获取姓名及项目组名称
  // ChangeIp w;
   // ChangeIp w;
   




    w.setWindowTitle(QString::fromLocal8Bit("小工具App_pkuncii"));
    //QVBoxLayout *layout = new QVBoxLayout(&w);

    // Display the ipconfig output

    //displayIpConfig(layout, output);

    //w.setLayout(layout);
    //w.resize(600, 400);
    w.show();
    return a.exec();
}
